package com.apes.fn.scm.retailOrder.model;

import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @BelongsProject: apes-server
 * @BelongsPackage: com.apes.fn.scm.retailOrder.model
 * @ClassName: OrderType
 * @Author: pyb
 * @Description: 单据类型
 * @CreateTime: 2021-06-18 13:42
 * @Version: 1.0
 */
@Getter
public enum BusinessOrderType {
    RetailOrder("RetailOrder", "零售单"), SaleOrder("SaleOrder", "分销单"),
    SaleReturn("SaleReturn", "分销退货单"), Voucher("Voucher", "内协退货凭证"),
    Deposit("AdvancePayment", "订金"), FundIncome("MoneyIncome", "资金收入"), UsedCar("UsedCar", "二手车"),
    IntroductionFee("IntroductionFee", "定损报价单"),Cross("Cross", "跨公司结算");
    String orderType;
    String orderTypeName;

    BusinessOrderType(String orderType, String orderTypeName) {
        this.orderType = orderType;
        this.orderTypeName = orderTypeName;
    }

    public static BusinessOrderType getBusinessOrderTypeByOrderType(String orderType) {
        return Arrays.stream(values()).filter(value -> Objects.equals(value.getOrderType(), orderType)).findFirst().orElse(null);

    }
}
